/*
 * Project: SmartWard
 * Package: com.yesoft.ward.basic.entity
 * File: RestDTO
 * Date: 2019/4/9 10:37
 * Version: V1.0
 * Copyright © 2018 - 2019 YESOFT CHINA, Inc. All Rights Reserved.
 */
package com.ruoyi.ichen.base.rest;

import org.apache.http.HttpStatus;

/**
 * @ClassName: RestDTO
 * @Description: RestDTO
 * @Author Jun
 * @Date: 2019/4/9 10:37
 * @Version: V1.0
 */
public class RestDTO<T> {
    protected Integer code = HttpStatus.SC_OK;
    protected String msg = "success";
    protected T data;

    public RestDTO(){}

    public RestDTO(Boolean success) {
        this(success, null);
    }

    public RestDTO(Boolean success, T data) {
        this((success ? HttpStatus.SC_OK : HttpStatus.SC_BAD_REQUEST), (success ? "操作成功" : "操作失败"), data);
    }

    public RestDTO(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    /**
     * @return the msg
     */
    public String getMsg() {
        return msg;
    }

    /**
     * @param msg the msg to set
     */
    public void setMsg(String msg) {
        this.msg = msg;
    }

    /**
     * @return the code
     */
    public Integer getCode() {
        return code;
    }

    /**
     * @param code the code to set
     */
    public void setCode(Integer code) {
        this.code = code;
    }

    /**
     * @return the data
     */
    public T getData() {
        return data;
    }

    /**
     * @param data the data to set
     */
    public void setData(T data) {
        this.data = data;
    }
}
